package factory;

import factory.abstractFactory.huawei.huaweiFactory;
import factory.abstractFactory.product.phone;
import factory.abstractFactory.product.router;
import factory.abstractFactory.xiaomi.xiaomiFactory;

public class test {
    public static void main(String[] args) {
////  简单工厂模式
//        car car1 =FactorySimple.getCar("小米");
//        car car2 =FactorySimple.getCar("五菱宏光");
//        car car3 =FactorySimple.getCar("特斯拉");
////  工厂方法模式
//        car car4 =new TeslaFactory().getCar();
//        car car5 =new wulingFactory().getCar();
//        car car6 =new xiaomiFactory().getCar();
//
////  name
//        if (car1 != null) {
//            car1.name();
//        }
//        if (car2 != null) {
//            car2.name();
//        }
//        if (car3 != null) {
//            car3.name();
//        }
//        System.out.println("--------------------------");
//        car4.name();
//        car5.name();
//        car6.name();

//  创建工厂
        xiaomiFactory xiaomi = new xiaomiFactory();
        huaweiFactory huawei = new huaweiFactory();

//  产品生产
        phone phone1 = xiaomi.getPhone();
        phone phone2 = huawei.getPhone();
        router router1 = xiaomi.getRouter();
        router router2 = huawei.getRouter();

//  产品测试
        System.out.println("phone test");
        phone1.startUp();
        phone1.call();
        phone1.shutUp();
        System.out.println("-------------------------");
        phone2.startUp();
        phone2.call();
        phone2.shutUp();
        System.out.println("\nrouter test");
        router1.startUp();
        router1.linkWifi();
        router1.shutUp();
        System.out.println("-------------------------");
        router2.startUp();
        router2.linkWifi();
        router2.shutUp();
    }
}
